package com.example.jacky.android_easeui.utils;

import android.app.Activity;
import android.content.Intent;

/**
 * Created by jacky on 2016/10/8.
 * sounbus app-developer
 */

public class Jump2ActivityUtils {

    /**
     * 激活Activity组件意图
     **/
    private Intent mIntent = new Intent();
    /***
     * 上下文
     **/
    private Activity mContext = null;

    public Intent getmIntent() {
        return mIntent;
    }

    public Jump2ActivityUtils(Activity mContext) {
        this.mContext = mContext;
    }

    /**
     * 跳转Activity
     *
     * @param targetActivity 需要跳转至的Activity
     */
    public void forward(Class<? extends Activity> targetActivity) {
        mIntent.setClass(mContext, targetActivity);
        mContext.startActivity(mIntent);
//        mContext.overridePendingTransition(R.anim.base_slide_right_in, R.anim.base_slide_remain);
    }

    public void forward(Class<? extends Activity> targetActivity, String intentKey, String intentValue) {
        getmIntent().putExtra(intentKey, intentValue);
        forward(targetActivity);
    }

    public void forwardForResult(Class<? extends Activity> targetActivity, int requestCode) {
        mIntent.setClass(mContext, targetActivity);
        mContext.startActivityForResult(mIntent, requestCode);
    }
}
